<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
    <title>${menuDetail.name}</title>
<#include "/admin/main/include/link_head.ftl"/>
</head>

<body class="jr-body">
<div class="jr-main-content">
<@tags.pageHeading />

    <div class="wrapper">

        <div class="row">
            <div class="col-md-4">
            <@tags.table id="easyui-datagrid-left" options="bodyCls:'jr-easyui-body jr-no-pagination-info',
            url:'page',
            singleSelect:true,
            onSelect:'onLeftSelect'">
                <@tags.th options="field:'ck',checkbox:true"></@tags.th>
                <@tags.th options="field:'name',width:180,formatter:'uiLink',sortable:false"><@spring.message '站群名称' /></@tags.th>
                <@tags.th options="field:'op',width:80,formatter:'uiMenu',sortable:false,align:'center'"><@spring.message '操作' /></@tags.th>
            </@tags.table>
            <@tags.gridBtns id="tbMain" btns="search,add,remove,sort,export" />
            <@tags.gridCons gridId="easyui-datagrid-left" forms="[
                        {
                            type:'text',
                            field:'name',
                            op:'like',
                            text:'站群名称'
                        }
                    ]" />
            </div>
            <div class="col-md-8">
            <@tags.table id="easyui-datagrid-right" options="toolbar:'#tbSlave',
            url:'/admin/plugin/common-website/page',
            singleSelect:true">
                <@tags.th options="field:'ck',checkbox:true,sortable:false"></@tags.th>
                <@tags.th options="field:'no',width:100,sortable:false,align:'center'"><@spring.message '站点编号' /></@tags.th>
                <@tags.th options="field:'name',width:300,formatter:'uiLink',sortable:false"><@spring.message '站点名称' /></@tags.th>
                <@tags.th options="field:'op',width:80,formatter:'uiOp',sortable:false,align:'center'"><@spring.message '站点配置' /></@tags.th>
            </@tags.table>
            <@tags.gridBtns id="tbSlave" btns="search,add,remove,sort,export" urls="add:'/admin/plugin/common-website/edit',remove:'/admin/plugin/common-website/delete'" />
            <@tags.gridCons gridId="easyui-datagrid-right" forms="[
                        {
                            type:'text',
                            field:'no',
                            op:'like',
                            text:'站点编号'
                        },
                        {
                            type:'text',
                            field:'name',
                            op:'like',
                            text:'站点名称'
                        }
                    ]" />
            </div>
        </div>

    </div>
</div>
</body>
</html>
<#include "/admin/main/include/link_foot.ftl"/>
<script type="text/javascript">
    function onLeftSelect(rowIndex, rowData) {
        $("#easyui-datagrid-right").datagrid("load", {
            'search.eq.gid': rowData.id,
            'sort': 'no',
            order: 'asc'
        });
    }
    $(function () {
        $("#tbSlave .jr-add").unbind("click");
        $("#tbSlave .jr-add").click(function () {
            var selected = $("#easyui-datagrid-left").datagrid("getSelected");
            if (null == selected) {
                alert("请先选择站群。");
                return false;
            }
            var id = selected.id;
            win(contextPath + "/admin/plugin/common-website/edit?gid=" + id + "&mid=${menuDetail.id}");
        });
    })
    function uiOp(value, row, index) {
        var htm = '<button class="btn btn-primary btn-sm" type="button" onclick="doWebsiteSetting(\'' + row.id + '\')"><@spring.message '配置' /></button>';
        return htm;
    }
    function doWebsiteSetting(id) {
        win(contextPath + "/admin/plugin/common-website/websiteSetting?id=" + id + "&mid=${menuDetail.id}");
    }
    function uiMenu(value, row, index) {
        var htm = '<button class="btn btn-primary btn-sm" type="button" onclick="doMenu(\'' + row.id + '\')"><@spring.message '菜单管理' /></button>';
        return htm;
    }
    function doMenu(id) {
        win("menuList?gid=" + id + "&mid=${menuDetail.id}");
    }
</script>